/*
 * @Description:
 * @Date: 2023-04-14 10:14:26
 * @LastEditors: czp
 * @LastEditTime: 2023-05-09 10:16:41
 */
import axios from "@/utils/axios";
import { IDictI, IPaginationReq } from "../interface/base";
import { IPaginationResp } from "../interface/base";
import { IPointsDetailed, IPointsExchangeRecord, IPointsGoods } from "../interface/points";
import { IPlaceAnOrderForm } from "@/views/user/components/Points/components/PlaceAnOrderDialog.vue";

/**
 * 获取积分商品分类
 */
export const pointsGetPointsGoodsCategory = () => {
	return axios.request<IDictI[]>({
		url: "api/front/exchangeGoodsCategory/getList",
		method: "POST"
	});
};
/**
 * 获取积分商品列表
 */
export const pointsGetPointsGoodsList = (options: IPaginationReq & { exchangeGoodsCategoryId: number }) => {
	return axios.request<IPaginationResp<IPointsGoods>>({
		url: "api/front/exchangeGoods/getList",
		method: "POST",
		data: options
	});
};
/**
 * 兑换商品
 */
export const pointsExchangeGoods = (options: IPlaceAnOrderForm) => {
	return axios.request<null>({
		url: "api/front/exchangeOrder/exchange",
		method: "POST",
		data: options
	});
};
/**
 * 获取兑换商品记录
 */
export const pointsGetExchangeGoodsRecord = () => {
	return axios.request<IPointsExchangeRecord[]>({
		url: "api/front/exchangeOrder/getList",
		method: "POST"
	});
};
/**
 * 获取明细
 */
export const pointsGetDetailed = (options: IPaginationReq & { io: string }) => {
	return axios.request<IPaginationResp<IPointsDetailed>>({
		url: "api/front/integralDetailed/getList",
		method: "POST",
		data: options
	});
};
